UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NkTPqymp62INYyv2Dm4jtz9fwaHgq3l62mLAcThv8j8=' 
WHERE 
  key_id = '9a34a2d60feed3195e17a4822c2f51ea4fe862e388ab2e79de88ce8deebaced8' 
  AND (
    token = 'NkTPqymp62INYyv2Dm4jtz9fwaHgq3l62mLAcThv8j8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054