UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMmK6AEJLWFfcx48XbY+9gtV2u3aa/s6ToiDVUwTBUM=' 
WHERE 
  key_id = 'd61a2ed5f0c72d5fa6490e0298e79df091687b88a27a1e748ed1faccc8d83f69' 
  AND (
    token = 'KMmK6AEJLWFfcx48XbY+9gtV2u3aa/s6ToiDVUwTBUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039