UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bImsgfL7PNHgsClSaem1Senskob2O8Iy/eR/FzhEyxI=' 
WHERE 
  key_id = '56a336274f06d6a9ecd58a786f4aaec912dd63344b101d870e4baf67228f4d42' 
  AND (
    token = 'bImsgfL7PNHgsClSaem1Senskob2O8Iy/eR/FzhEyxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027