UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KnFSYgyUmbSqa7uCyS2ilyLrAOkcYMyx0M3ez4TViMs=' 
WHERE 
  key_id = 'c368a018b9a199d044fabfb9746e156681659bcd27a7391701132100505b57fa' 
  AND (
    token = 'KnFSYgyUmbSqa7uCyS2ilyLrAOkcYMyx0M3ez4TViMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031