UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O3bIifIds3UXOqVgrMH67UPKfXW7V8aa9OhkyhSIm/0='
WHERE
key_id = '3d2b862fc51a67895770811cd93b4417479b47c0baaa84b2aad87cb451a7819e'
AND (
token = 'O3bIifIds3UXOqVgrMH67UPKfXW7V8aa9OhkyhSIm/0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)