UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mYNp5mAA1V1PvToZySGVlk3wQ426zWWpSp03MZ66x2k=' 
WHERE 
  key_id = '221214b6c0267140a2821addb59b39e5e03aeb33e1851995c00bd40b753f03ed' 
  AND (
    token = 'mYNp5mAA1V1PvToZySGVlk3wQ426zWWpSp03MZ66x2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070