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