UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OgCNIcdPODpi4H6jDK1qdr8IUb5W6ZKIydYPKxO/3J4='
WHERE
key_id = 'b1a782522eb4e551706c8d0c0417aaca15987e2580cfe3cf12417492d5744ac9'
AND (
token = 'OgCNIcdPODpi4H6jDK1qdr8IUb5W6ZKIydYPKxO/3J4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)