UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tuBBJ3BgIE/coCf3tumVfFv4yThxrlaz60FNmxVLMnk='
WHERE
key_id = 'c7ec15acc1370f1a207156c68551fa87cef574499e585758053e07d63905c3f3'
AND (
token = 'tuBBJ3BgIE/coCf3tumVfFv4yThxrlaz60FNmxVLMnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)