UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UOLJdUIQtP8wlnl/3ejcjIa6WVS7CawxqRufgxkDTzg=' 
WHERE 
  key_id = '65b2982ac5b9f1cb2a28795230b30135486e9de81495c231465ce99021cba15a' 
  AND (
    token = 'UOLJdUIQtP8wlnl/3ejcjIa6WVS7CawxqRufgxkDTzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042