UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RiuQs8Qxx78wBrvI+hKWOTwVfhcX70kJsAew0YquNK0=' 
WHERE 
  key_id = '18cd97ae33a827a70d1fa560a8c384759eae170447fc5ea67e1c7a9f2ef07c34' 
  AND (
    token = 'RiuQs8Qxx78wBrvI+hKWOTwVfhcX70kJsAew0YquNK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040