UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HrXLCG5TrN2oB/3lh+VZv/T1e4N9xRMCQ/MK84gnCLg=' 
WHERE 
  key_id = 'a118e2e2a29259684b71c248931768887536815f643fe0b0095bc2cc86384d3b' 
  AND (
    token = 'HrXLCG5TrN2oB/3lh+VZv/T1e4N9xRMCQ/MK84gnCLg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040