UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qZdybn5aY9dlY3xB9rd9KuznyTQVu3FKyZDF4OP1uwg='
WHERE
key_id = 'd6bc106a46d994516ae6ff03bffca635d8c1ba48af2fd668190ec11e39dfdf05'
AND (
token = 'qZdybn5aY9dlY3xB9rd9KuznyTQVu3FKyZDF4OP1uwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)