UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tauhb/11vGTs31Ok+ew0oUWgg0OtF4R5CIJiH+MygsQ='
WHERE
key_id = 'a9cb46a3e4963ceb8e4e3ad0828fa6c2d8bd678760f7861e4b8f38f7b8786515'
AND (
token = 'Tauhb/11vGTs31Ok+ew0oUWgg0OtF4R5CIJiH+MygsQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)