UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ywEHHEGbdPCcqtqbDjEd5jRhIzd0aCuaWUthQjXu8Iw=' 
WHERE 
  key_id = '780b1a090d407ce4d8ffd158a371c9d7084fcfc3e960f9800ddcaa1c598511a7' 
  AND (
    token = 'ywEHHEGbdPCcqtqbDjEd5jRhIzd0aCuaWUthQjXu8Iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040