UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pJ87jTvmU5t6+gumm+epmP9Vg4F1or3AuABLBOux1tk=' 
WHERE 
  key_id = '34b392d5fed626c002c75df3445f69595fa7a43eeecf15830be19ea247e12a47' 
  AND (
    token = 'pJ87jTvmU5t6+gumm+epmP9Vg4F1or3AuABLBOux1tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039