UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fAeI1ruYsNi6mIBqCNBhfyRPRbvEBXcKC2hLOxjFBSQ='
WHERE
key_id = '3c19d89765c2b8860286216159daefe0970f74c8d28a7e686851f143a0ab907d'
AND (
token = 'fAeI1ruYsNi6mIBqCNBhfyRPRbvEBXcKC2hLOxjFBSQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)