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