UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZEl0qkYNP63zEMOajr88hIKylhOhwsz+WPTchdCW6TM='
WHERE
key_id = 'a6ecfcaa9d494ea8132ad35aa8c1530ef6752bc097c24e3f7641ea018a8df997'
AND (
token = 'ZEl0qkYNP63zEMOajr88hIKylhOhwsz+WPTchdCW6TM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)