UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q8cPSuvDlNXR9Tb3fE/P2hXC0ov4OL4G1MJexOMDakU=' 
WHERE 
  key_id = 'bbbcbba27e941b06836331935735db78a459a74312c334f907a6fd6bb0388a2b' 
  AND (
    token = 'q8cPSuvDlNXR9Tb3fE/P2hXC0ov4OL4G1MJexOMDakU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038