UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wVM8xpInn/rMNbDq8vPerghG+7kYxqHMsDdd77j3V5M=' 
WHERE 
  key_id = '51c4546b66f9c7524e71f58a29e54df2e38419dc82eadb191cb0c3113e1f371e' 
  AND (
    token = 'wVM8xpInn/rMNbDq8vPerghG+7kYxqHMsDdd77j3V5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024