UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+OuaPhBbsq1iNfABqlVFQxTBI4raG1oOffedjEzix6c=' 
WHERE 
  key_id = '21edb522cc43866ee5bd7ed9cb99a60fa3b2d8aafc981ad1a4bf5ef3ffe1099d' 
  AND (
    token = '+OuaPhBbsq1iNfABqlVFQxTBI4raG1oOffedjEzix6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038