UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hQMEiqsKH90i15QdWD3izS7euieLKviZBFcnT+rGp0E=' 
WHERE 
  key_id = 'ff5cb89a3ba3aa01effbd80e8b099f85a862054777707107ebbe362e5ef6cd62' 
  AND (
    token = 'hQMEiqsKH90i15QdWD3izS7euieLKviZBFcnT+rGp0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042