UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Dys4RWE9Y6As28Hpqp5EB1qj8DSfL6iDF2UF3s3l+Lc='
WHERE
key_id = 'dd6aaee272171d3010cd7e04af8b8b58f486f6d7cfb02a040a7112a67e7541f0'
AND (
token = 'Dys4RWE9Y6As28Hpqp5EB1qj8DSfL6iDF2UF3s3l+Lc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)