UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yNSCzK/C45kA1gY/NCtIGPVZbBT1cF3dvqlEBqRvZsc=' 
WHERE 
  key_id = 'd13618054dc99e51f8da1c7be19099597f40444496461cebfa2e9c7e2d35e008' 
  AND (
    token = 'yNSCzK/C45kA1gY/NCtIGPVZbBT1cF3dvqlEBqRvZsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032