UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u5SV1AQ1b2sXAVk9iLtpEeYoU1GRtpEIPUGBL9t7NFA='
WHERE
key_id = 'f53934207325a297eed8dd8447998cb2e89f5f186870288775522a131899296a'
AND (
token = 'u5SV1AQ1b2sXAVk9iLtpEeYoU1GRtpEIPUGBL9t7NFA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)