UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AZ7y1qCdEuOVeyyX0Ppoie+QIaXL+wy0SfApM+D7zjc=' 
WHERE 
  key_id = 'b8670a79a774b3eefd4211c30eca1a3a8597e92bf48a93ce6381346bde0de381' 
  AND (
    token = 'AZ7y1qCdEuOVeyyX0Ppoie+QIaXL+wy0SfApM+D7zjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027