UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3cMMH5HV6Sb6l8EUILEX3TacLoFLgh5nxsAUUsxOClI='
WHERE
key_id = 'f3b6e4bacec8f7724530cff4418838b154546c5df689b48679523fd2ca5104ea'
AND (
token = '3cMMH5HV6Sb6l8EUILEX3TacLoFLgh5nxsAUUsxOClI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)