UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tmUXh0wKyk+k2KYMqMTCU2XsEGf8xYCenbXeV4Z3OVo='
WHERE
key_id = 'f50810a32eb41944a0f883298749c333bf30248cfb7228e43af0a606b16f11d4'
AND (
token = 'tmUXh0wKyk+k2KYMqMTCU2XsEGf8xYCenbXeV4Z3OVo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)