UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WsUu5nkfe5zZ4jGLkVyhgBT5CgUmIOMIdtqZH8DSD9Q='
WHERE
key_id = 'a0cae3c6a8b6d3889550843d6c76cd92e789531a4c726d11491651ea51874823'
AND (
token = 'WsUu5nkfe5zZ4jGLkVyhgBT5CgUmIOMIdtqZH8DSD9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)