UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oRAG7h08+sB5zD2Cy8JOSvRDWINFcjrqZzmOpPvRDdY='
WHERE
key_id = '86dd006bc9aba5f8fab94780ca64a7642df0633e4228345b35653ac1a64483e1'
AND (
token = 'oRAG7h08+sB5zD2Cy8JOSvRDWINFcjrqZzmOpPvRDdY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)