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

Query time 0.00042