UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IuQaBpG13r2wY3RV+RfM5KAbPjwIZTtAbPUj6nlORSU='
WHERE
key_id = 'ef954453ee7ce2ba1fea025d0b49760f3f0b85045be0debbffaf234d5a652479'
AND (
token = 'IuQaBpG13r2wY3RV+RfM5KAbPjwIZTtAbPUj6nlORSU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)