UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AETtnz3LBw55VPXyLHXESjkUjhXLzotDulkk+KQY5Lo=' 
WHERE 
  key_id = '1d866ae5371b329aad8544900b291a0bd7a52b745e9df17b8b6f580feea5fcbd' 
  AND (
    token = 'AETtnz3LBw55VPXyLHXESjkUjhXLzotDulkk+KQY5Lo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037