UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kHiNhNK+ocPiswIYMIxYj9o/COCPqsBgK6PKM4FpvaQ=' 
WHERE 
  key_id = '291a9cb016dac64b536f12d77f736b3a146296066e3b823daa898d7760253b56' 
  AND (
    token = 'kHiNhNK+ocPiswIYMIxYj9o/COCPqsBgK6PKM4FpvaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039