UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n+OXCnUGm5Gube0MfVEJPWOo3E9p6fN2Si0sPPNHvKw='
WHERE
key_id = 'b29098b524fe2b2adb513afd257045898081210c316aeae4cdf94959bab502b3'
AND (
token = 'n+OXCnUGm5Gube0MfVEJPWOo3E9p6fN2Si0sPPNHvKw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)