UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1YYXnhQG9W/wpUUcd3FLfHVrnOdfiInraKWwXhcJri0='
WHERE
key_id = '582e3448e80608858074048114f56d6115a24b7279b0e0a88fbf9c38ef751de8'
AND (
token = '1YYXnhQG9W/wpUUcd3FLfHVrnOdfiInraKWwXhcJri0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)