UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dAgY3/2mqstFFX9NDREc8mTZxeqk4szM4gf7JYea+6Y='
WHERE
key_id = 'b724599ddd05e9613494d1eb8ec591ccebf6830e0a2ca931ee50c879c9924312'
AND (
token = 'dAgY3/2mqstFFX9NDREc8mTZxeqk4szM4gf7JYea+6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)