UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P6xw2Cs6TWzzXm1JniiwohF7b5CxJqlHk2WoGOrOIPI=' 
WHERE 
  key_id = '949a5409d08534529e1415d2bc6993d58895745f164a4742c1906515e82413a8' 
  AND (
    token = 'P6xw2Cs6TWzzXm1JniiwohF7b5CxJqlHk2WoGOrOIPI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032