UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NUOfa3QWbVHPzlLz3mV1hXv3BFN6QEpEfGgfFwRY088='
WHERE
key_id = '4b91c56958418f057d28034ec869d0814d8f8761e42a8b5bf563b9e23968f8c5'
AND (
token = 'NUOfa3QWbVHPzlLz3mV1hXv3BFN6QEpEfGgfFwRY088='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)