UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dIgJUdb0L/hyKP1MGkUuVACe7KVV/sdW3lwMKrMH0gM='
WHERE
key_id = 'a1eb1f3f78ea265bd855ea9c77dc64cb8388dc0d85df3f7a2660f221f8975bbe'
AND (
token = 'dIgJUdb0L/hyKP1MGkUuVACe7KVV/sdW3lwMKrMH0gM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)