UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gq7DiXdtJOWoqBMV4aTSJhtYtNYdghpVQbT0p/MREyo='
WHERE
key_id = 'bd7467343be32d0a5030e905c2a85106422509d816f2af5e92415d4c09b29c17'
AND (
token = 'Gq7DiXdtJOWoqBMV4aTSJhtYtNYdghpVQbT0p/MREyo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)